﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Sistema.WF.Componentes.FormulariosBase;
using Sistema.WF.View.NFe;
using Sistema.Util;

namespace Sistema.WF.View.Kernel
{
    public partial class FRM_principal : FRM_pai
    {
     
        public FRM_principal()
        {
            InitializeComponent();
            
        }

        
        private void cadastrarEmpresaToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try { 
            FRM_cadastroEmpresa tela = new FRM_cadastroEmpresa();
            tela.MdiParent = this;
            tela.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Cadastrar Empresa", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }    
        }
        private void cadastroDeUsuáriosToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            { 
            FRM_cadastroUsuario tela = new FRM_cadastroUsuario();
            tela.MdiParent = this;
            tela.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Cadastrar Usuário", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }    
        }

        
        private void nFeToolStripMenuItem_Click(object sender, EventArgs e)
        {
            /*try { 
            NFe.FRM_principal tela = new NFe.FRM_principal();
            tela.MdiParent = this;
            tela.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "NFe Operações", MessageBoxButtons.OK, MessageBoxIcon.Information);
            } */   
        }

        private void sairToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();
            this.Dispose();
        }

        private void enviarToolStripMenuItem_Click(object sender, EventArgs e)
        {
             try 
             { 
                FRM_EnviaNota tela = new FRM_EnviaNota();
                tela.MdiParent = this;
                tela.Show();
             }
             catch (Exception ex)
             {
                 MessageBox.Show(ex.Message, "NFe Operações", MessageBoxButtons.OK, MessageBoxIcon.Information);
             } 
        }

        private void demaisOperaçõesToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                NFe.FRM_principal tela = new NFe.FRM_principal();
                tela.MdiParent = this;
                tela.Show();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "NFe Operações", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }

        private void certificadoDigitalToolStripMenuItem_Click(object sender, EventArgs e)
        {
            FRM_certificado tela = new FRM_certificado();
            
            try
            {
                tela.MdiParent = this;
                tela.Show();
            }
            catch (Exception)
            {
                CaixaMensagem.CaixaDeMensagem("Por favor, selecione um Certificado Digital");
            }
            tela.Close();
        }

        private void FRM_principal_Load(object sender, EventArgs e)
        {
            //troca a cor de fundoi de um form MDi
            MdiClient ctlMDI = (MdiClient)this.Controls[this.Controls.Count - 1];
            ctlMDI.BackColor = Color.White;


            toolStripStatusLabel1.Text = DateTime.Now.ToShortDateString();
            toolStripStatusLabel1.BackColor = System.Drawing.Color.Transparent;
            toolStripStatusLabel1.Alignment = ToolStripItemAlignment.Right;
            
        }
    }
}
